Skip to content

Comments

feat: dc - scheme selection#234

Merged
jakubjasinsky merged 1 commit intomasterfrom
prefereed-schemes
Feb 19, 2026
Merged

feat: dc - scheme selection#234
jakubjasinsky merged 1 commit intomasterfrom
prefereed-schemes

Conversation

@jakubjasinsky
Copy link
Collaborator

Summary

Add card scheme selection support to Dynamic Checkout and fix inverted restriction
logic for IIN/scheme allowlists.

Changes

Scheme selection support (card.ts)

  • Pass enableCardSchemeSelection and preferredSchemes options to the card form
    from the payment method config
  • Only render the single scheme logo when scheme selection is disabled (the card form
    handles scheme UI when enabled)
  • Only update the scheme logo dynamically on input when scheme selection is disabled
  • Add scheme_selection_enabled and scheme_selection_default_order to the Card
    type

Fix card restriction logic (card.ts)

  • Fix validateCardRestrictions: restrict_to_schemes is an allowlist, but the
    previous logic treated matches as blocked — inverted the condition so cards are
    restricted only when their scheme is not in the list
  • Fix handleIinRestrictionFromMessage: same inversion fix for restrict_to_iins
    cards are now restricted only when the IIN is not in the allowlist

Impact

  • Cards with schemes/IINs matching restrict_to_schemes/restrict_to_iins were
    previously incorrectly blocked. This fix unblocks valid cards and correctly blocks
    cards outside the allowlist.
  • Merchants using scheme selection will now see the native card form scheme picker
    instead of a static logo.

Testing Plan

  • Enable scheme selection on a payment method config (scheme_selection_enabled: true)
  • Enter a co-branded card number (e.g. Mastercard/Maestro BIN) and verify the scheme
    selector appears
  • Verify the single scheme logo does not render when scheme selection is enabled
  • Configure restrict_to_schemes: ["mastercard"], enter a Mastercard-eligible card,
    and verify it is allowed
  • With the same config, select a scheme not in the allowlist and verify the card is
    restricted
  • Configure restrict_to_iins with a specific IIN, enter a card matching that IIN,
    and verify it is allowed
  • Enter a card with a different IIN and verify it is restricted
  • Disable scheme selection and verify the dynamic logo still updates on input

Additional Context

The restriction logic used variable names like isBlockedScheme / blockedScheme
which led to treating the allowlist as a blocklist. The fix renames and simplifies
the logic to make intent clear (hasAllowedScheme, isAllowedIin).

@jakubjasinsky jakubjasinsky requested review from a team and mateusz-walesiak-cko and removed request for a team February 17, 2026 18:19
@jakubjasinsky jakubjasinsky merged commit b29da42 into master Feb 19, 2026
5 checks passed
@jakubjasinsky jakubjasinsky deleted the prefereed-schemes branch February 19, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants